package com.geek.bucks.entity;

import lombok.*;

@Data
@Setter
@Getter
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Builder
public class VO<T> {
    Integer code;
    String msg;
    T data;

    private VO(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private VO(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static VO<Object> success(Object data) {
        return new VO<>(0, "成功", data);
    }

    public static VO<Object> error(Integer code, String msg) {
        return new VO<>(code, msg);
    }
}
